/******************************************************************************/
/*                                                                            */
/*  Copyright (c) 2009: ngi-central.org                                       */
/*  All rights reserved.                                                      */
/*                                                                            */
/******************************************************************************/


#include <boost/test/unit_test.hpp>

#include "..\..\include\sgl\vector.h"
#include "..\..\include\sgl\point.h"
#include "..\..\include\sgl\line_segment.h"
#include "..\..\include\sgl\bounding_box.h"

BOOST_AUTO_TEST_SUITE( bounding_box2d )


BOOST_AUTO_TEST_CASE( bounding_box__point2d )
{
	sgl::point<2> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<2>(a, sgl::vector<2>()) );

	sgl::point<2> b(1, 2);

	BOOST_CHECK( bounding_box(b) == sgl::box<2>(b, sgl::vector<2>()) );
}

BOOST_AUTO_TEST_CASE( bounding_box__vector2d )
{
	sgl::vector<2> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<2>(sgl::point<2>(), a) );

	sgl::vector<2> b(1, 2);

	BOOST_CHECK( bounding_box(b) == sgl::box<2>(sgl::point<2>(), b) );
}

BOOST_AUTO_TEST_CASE( bounding_box__box2d )
{
	sgl::box<2> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<2>() );

	sgl::box<2> b(
		sgl::point<2>(1, 2),
		sgl::vector<2>(3, 4));

	BOOST_CHECK( bounding_box(b) == sgl::box<2>(sgl::point<2>(1, 2),
		sgl::vector<2>(3, 4)) );
}

BOOST_AUTO_TEST_CASE( bounding_box__polygon2d )
{
	sgl::polygon<2> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<2>() );

	sgl::polygon<2> b(
		sgl::quadrilateral<2>(
			sgl::point<2>(1, 2),
			sgl::point<2>(3, 4),
			sgl::point<2>(5, 6),
			sgl::point<2>(7, 8)));

	BOOST_CHECK( bounding_box(b) == sgl::box<2>(sgl::point<2>(1, 2),
		sgl::vector<2>(6, 6)) );
}


BOOST_AUTO_TEST_SUITE_END()

